<?php

/**
 * item_action_field filter form base class.
 *
 * @package    forumCDE
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Baseitem_action_fieldFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'owner_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('actionwf'), 'add_empty' => true)),
      'fieldname'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'detail'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'caption'          => new sfWidgetFormFilterInput(),
      'helptext'         => new sfWidgetFormFilterInput(),
      'notnull'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'readonly'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'xdefault'         => new sfWidgetFormFilterInput(),
      'onlyblank'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'filter'           => new sfWidgetFormFilterInput(),
      'categorie_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => true)),
      'htmlattributes'   => new sfWidgetFormFilterInput(),
      'onchangefunction' => new sfWidgetFormFilterInput(),
      'script'           => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'owner_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('actionwf'), 'column' => 'id')),
      'fieldname'        => new sfValidatorPass(array('required' => false)),
      'detail'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'caption'          => new sfValidatorPass(array('required' => false)),
      'helptext'         => new sfValidatorPass(array('required' => false)),
      'notnull'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'readonly'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'xdefault'         => new sfValidatorPass(array('required' => false)),
      'onlyblank'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'filter'           => new sfValidatorPass(array('required' => false)),
      'categorie_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('categorie'), 'column' => 'id')),
      'htmlattributes'   => new sfValidatorPass(array('required' => false)),
      'onchangefunction' => new sfValidatorPass(array('required' => false)),
      'script'           => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('item_action_field_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'item_action_field';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'owner_id'         => 'ForeignKey',
      'fieldname'        => 'Text',
      'detail'           => 'Boolean',
      'caption'          => 'Text',
      'helptext'         => 'Text',
      'notnull'          => 'Boolean',
      'readonly'         => 'Boolean',
      'xdefault'         => 'Text',
      'onlyblank'        => 'Boolean',
      'filter'           => 'Text',
      'categorie_id'     => 'ForeignKey',
      'htmlattributes'   => 'Text',
      'onchangefunction' => 'Text',
      'script'           => 'Text',
    );
  }
}
